package com.changgou.item.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.item.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 老大哥在看着你
 *
 * @author ANG.YU
 * @date 2019-10-11 15:07
 */
@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    @PostMapping
    public Map<String, Object> search(@RequestBody Map<String, String> searchMap) {
        return searchService.search(searchMap);
    }


    @GetMapping("/importData")
    public Result importData() {
        searchService.importData();
        return new Result(true, StatusCode.OK, "导入成功");
    }
}
